package com.chushouya.order.constants;


import com.general.framework.core.enums.IEnum;
import com.general.framework.core.lang.Strings;

import java.util.Objects;

public enum OrderSourceEnum implements IEnum<Integer> {

    OFFICIAL_SOURCE(0, "官方"),

    SELF_CREATE_SOURCE(1, "自主下单"),

    RETURN_SOURCE(2, "回头客"),

    MULTI_SOURCE(3, "一单多台"),
    //通过分享形式下单
    PRIVATE_SOURCE(4, "分享下单"),

    CMCC(5, "移动门店"),
    CMCC_OFFLINE(6, "移动线下"),
    CMCC_ONLINE(7, "移动线上"),

    OFFLINE_STORE(8, "线下门店"),
    ;

    private final Integer value;

    private final String desc;

    OrderSourceEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String getDesc(Integer status) {
        for (OrderSourceEnum thisEnum : OrderSourceEnum.values()) {
            if (Objects.equals(thisEnum.value, status)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }

    @Override
    public Integer value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }
}
